   Ext.define('MyApp.view.Login',{
        extend: 'Ext.form.Panel',
        alias: 'widget.login',
        // requires: [
        //     'MyApp.view.controller.Users',
        // ],
        width: 400,
        height: 200,
        frame: true,
        //layout: 'fit',//'anchor',
        id: 'mylogin',
        title: 'Form Panel注册',
        bodyPadding: 5,
        defaultType: 'textfield',
        items:[
            {
                //title:'hello',

            },{
                xtype:'panel',
                layout: 'anchor',
                title: 'Login',
                width:300,
                height: 180,
                bodyPadding: 5,
                defaultType: 'textfield',
                items: [{
                    fieldLabel: '用户名',
                    id:'username',
                    name: 'username',
                    maxLength:25,
                    value:'aaaa',
                    allowBlank: false
                },{
                    fieldLabel: '密码',
                    id:'password',
                    name: 'password',
                    inputType: 'password',
                    minLength:6,
                    maxLength:25,
                    allowBlank: false
                },
                {
                    fieldLabel: '确认密码',
                    id:'qrpassword',
                    name: 'qrpassword',
                    inputType: 'password',
                    minLength:6,
                    maxLength:25,
                    allowBlank: false
                },
                {xtype:'checkbox',
                   boxLabel: '记住密码',
                   name:'topping',
                   inputValue: '1',
                   id: 'checkbox1'
                }],
                buttons:[{
                    text:'忘记密码',
                    id:'forgetpwd',
                    name:'forgetpwd',
                    handler:function(){
                        console.log('forgetpwd');
                    }
                },{
                    text:'重置',
                    id:'reset',
                    name:'reset',
                    handler:function(btn){
                        console.log(btn.ownerCt.ownerCt.queryById('username'));
                        console.log('reset');
                        console.log(Ext.get('username'));
                        console.log(Ext.get('username').id);
                        console.log(btn.ownerCt.ownerCt.queryById('username').value);
                        //console.log(Ext.get('username').getValue());
                        //Ext.get('username').value = '';
                }},{
                    text:'提交',
                    id:'submit',
                    name:'submit',
                    handler:function(btn){
                        console.log('submit');
                        var username = btn.ownerCt.ownerCt.queryById('username').value;
                        var password = btn.ownerCt.ownerCt.queryById('password').value;
                        var qrpassword = btn.ownerCt.ownerCt.queryById('qrpassword').value;
                        if(password !== qrpassword){
                            Ext.Msg.alert('注意','两次密码输入不一致');
                        }else{
                            Ext.Ajax.request({
                                //url: 'page.php',
                                url: 'login',
                                timeout: 60000,
                                cors:true,
                                method: 'POST',
                                params: {
                                    id: 1,
                                    username: username,
                                    password: password,
                                    qrpassword: qrpassword
                                },
                                success: function(response, opts){
                                    //var text = Ext.decode(response.responseText);
                                    var text = response.responseText;
                                    // process server response here
                                    console.dir(text);
                                    alert(response.responseText);
                                },
                                failure: function(response, opts) {
                                    //alert(response.responseText);
                                    console.log('server-side failure with status code ' + response.status);
                                }
                            });
                        }
                    }
                }],
                renderTo: Ext.getBody()
            }
        ]
    });
